<fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
    <legend>资料修改</legend>
</fieldset>
<div class="layui-row">
    <div class="layui-col-md5  layui-col-md-offset3">
        <form class="layui-form" action="{:U('editPersonInfo')}" method="post">
            <table class="layui-table" lay-even lay-skin="nob" lay-size="lg">
                <colgroup>
                    <col width="150">
                    <col width="150">
                    <col width="150">
                </colgroup>
                <tbody>
                <tr></tr>
                <tr>
                    <td>姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名：</td>
                    <td><input type="text" name="name" lay-verify="required" placeholder="" autocomplete="off"
                               class="layui-input" style="border-radius: 10px;" value="{$info['name']}"></td>
                </tr>
                <tr>
                    <td>性&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别：</td>
                    <td >
                        <switch name="info['sex']">
                            <case value="1">
                                <input class="sex" name="sex" value="1" type="hidden">
                            </case>
                            <case value="2">
                                <input class="sex" name="sex" value="2" type="hidden">
                            </case>
                            <default />
                        </switch>
                        <input  id="man" type="radio" name="sexSelect" value="1" lay-filter="radio" title="男"  >
                        <input  id="woman" type="radio" name="sexSelect" value="2" lay-filter="radio" title="女" >
                    </td>
                </tr>
                <tr>
                    <td>邮&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;箱：</td>
                    <td><input type="text" name="email" lay-verify="email" placeholder="" autocomplete="off"
                               class="layui-input" style="border-radius: 10px;" value="{$info['email']}"></td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <button class="layui-btn  layui-btn-normal" style="border-radius: 10px;margin-left: 75%;"
                                lay-submit="" id="save" lay-filter="demo1">保存
                        </button>
                    </td>
                </tr>
                </tbody>
            </table>
        </form>
    </div>
</div>
<script>
    layui.use('form', function(){
        var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功-->
        //但是，如果你的HTML是动态生成的，自动渲染就会失效
        //因此你需要在相应的地方，执行下述方法来手动渲染，跟这类似的还有 element.init();
        form.render();
        form.on('radio(radio)', function(data){
//            console.log(data.elem); //得到radio原始DOM对象
//            console.log(data.value); //被点击的radio的value值
            /*
            * 其实不用这么麻烦，因为后台使用的是empty判空操作
            * */
            $('.sex').val(data.value);
        });
    });
</script>
